
def test_func():
    print "test func"
    
import SocketServer 
   
#this is the test
class UCHandler(SocketServer.BaseRequestHandler):

    def handle(self):
        print "Connected:", self.client_address
        while 1:
            data = self.request.recv(1024)
            if data == "\r\n":
                
                break
            print "after receive"
            print data[:-2]
            self.request.send(data.upper())
            
        
def main(*argv):
    myaddr = ('127.0.0.1', 2345)
    myserver = SocketServer.ThreadingTCPServer(myaddr,UCHandler)
    myserver.serve_forever()

if __name__ == '__main__':
    main()
